package cn.mado.org.service.impl;

import cn.mado.basic.util.PageList;
import cn.mado.org.domain.Log;
import cn.mado.org.mapper.LogMapper;
import cn.mado.org.query.LogQuery;
import cn.mado.org.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogServiceImpl implements LogService {

    @Autowired
    private LogMapper logMapper;

    @Override
    public void save(Log log) {
        logMapper.add(log);
    }

    @Override
    public PageList<Log> queryPage(LogQuery query) {
        Integer totals = logMapper.queryByTotals(query);
        List<Log> log = logMapper.queryByLog(query);
        return new PageList<Log>(totals,log);
    }
}
